//
//  JARetweetedStatusCell.swift
//  JAWeiBo
//
//  Created by Arvin on 17/4/7.
//  Copyright © 2017年 Arvin. All rights reserved.
//

import UIKit

class JARetweetedStatusCell: UITableViewCell {

    ///微博数据模型
    var statusViewModel: JAStatusViewModel? {
        didSet {
            originalView.statusViewModel = statusViewModel
            retweetedView.statusViewModel = statusViewModel
        }
    }
    
    ///原创微博部分
    lazy var originalView: JAOriginalStatusView = JAOriginalStatusView()
    
    ///转发微博部分
    lazy var retweetedView: JARetweetedStatusView = JARetweetedStatusView()
   
    ///cell底部的bar
    lazy var toolBar:JAStatusToolBar = JAStatusToolBar()
    
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        setupUI()
        
        //隐藏分隔线
        self.selectionStyle = .none
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}

// MARK: - 设置UI
extension JARetweetedStatusCell {
    fileprivate func setupUI () {
        
        self.contentView.backgroundColor = home_CellColor
        
        
        //添加子视图
        self.contentView.addSubview(originalView)
        self.contentView.addSubview(retweetedView)
        self.contentView.addSubview(toolBar)
        
        originalView.backgroundColor = UIColor.white
        retweetedView.backgroundColor = home_CellColor
        
        
        
        //添加约束
        originalView.snp.makeConstraints { (make) in
            make.top.equalTo(self.contentView).offset(5)
            make.left.right.equalTo(self.contentView)
        }
        retweetedView.snp.makeConstraints { (make) in
            make.top.equalTo(originalView.snp.bottom)
            make.left.right.equalTo(self.contentView)

        }
        
        toolBar.snp.makeConstraints { (make) in
            make.top.equalTo(retweetedView.snp.bottom)
            make.left.bottom.right.equalTo(self.contentView)
            make.height.equalTo(36)
        }

        
    }
}
